package spring_learn.a03;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@PropertySource("application.properties")
public class bean1 {

    private static final Logger logger= LoggerFactory.getLogger(bean1.class);

    public bean1(){logger.info("构造方法执行");}

    @Autowired
    public void autowire(@Value("${name}") String name){logger.info("依赖注入:{}",name);}

    @PostConstruct
    public void init(){
        logger.info("初始化");
    }

    @PreDestroy
    public void destory(){
        logger.info("摧毁");
    }
}
